package top.yifengxiner.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.yifengxiner.system.mapper.SysUserMapper;
import top.yifengxiner.system.service.SysUserService;
import top.yifengxiner.common.core.pojo.entity.SysUser;

/**
 * @author ：baixiao
 * @date ：Created in 2021/5/6 11:00
 * @description：用户服务层
 * @modified By：
 * @version: 0.0.1$
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper,SysUser> implements SysUserService
{

    @Autowired
    private SysUserMapper userMapper;

    @Override
    public boolean registerUser(SysUser user)
    {
        int res = userMapper.insert(user);
        if(res == 1)
        {
            return true;
        }
        return false;
    }

    @Override
    public SysUser selectUserByUsername(String username)
    {
        return userMapper.selectOne(new QueryWrapper<SysUser>().eq("user_name",username));
    }
}
